package com.micro.modual.controller;

import com.micro.core.resp.RespJson;
import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.bo.feedback.FeedbackBO;
import com.micro.modual.model.dto.feedback.FeedbackDetailDTO;
import com.micro.modual.model.dto.feedback.FeedbackListDTO;
import com.micro.modual.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import java.util.Map;

/**
 * <h1>意见反馈表 控制器</h1>
 * @author levelcoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:27:47
 */
@Api(value = "意见反馈管理",tags = "意见反馈管理")
@RestController
@RequestMapping(value = "feedback")
public class FeedbackController {

    @Autowired
    private FeedbackService feedbackService;

    /**
     * <h2>查找意见反馈表 列表</h2>
     * @param params 列表查询请求对象
     * @return List<FeedbackListDTO> {@link FeedbackListDTO}s  意见反馈表 列表返回对象
     */
    @ApiOperation(value = "查询意见反馈表列表" ,notes = "查询意见反馈表列表")
    @GetMapping(value = "/findFeedbackList")
    public RespJsonPageData<FeedbackListDTO> findFeedbackList(@RequestParam  Map<String,Object> params){
        return feedbackService.findList(params,FeedbackListDTO.class);
    }

    /**
     * <h2>根据主键编号查看意见反馈表详情</h2>
     * @param id  意见反馈表 主键编号
     * @return {@link FeedbackDetailDTO}  意见反馈表 详情
     */
    @ApiOperation(value = "查询意见反馈表详情",notes = "根据主键编号，查询意见反馈表详情")
    @GetMapping(value = "/findFeedbackDetail/{id}")
    public RespJsonData<FeedbackDetailDTO> findFeedbackDetail(@PathVariable("id") Long id){
        return feedbackService.findDetail(id,FeedbackDetailDTO.class);
    }

    /**
     * <h2>根据主键编号修改意见反馈查看状态</h2>
     * @param id 意见反馈表 主键编号
     */
    @PostMapping(value = "/modifyFeedBackStatus/{id}")
    public void modifyFeedBackStatus(@PathVariable("id") Long id){
        feedbackService.modifyFeedBackStatus(id);
    }


    /**
     * <h2>根据主键编号删除意见反馈表信息</h2>
     * @param id  意见反馈表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "删除意见反馈表",notes = "根据地址ID，删除意见反馈表")
    @PostMapping(value = "/deleteFeedback/{id}")
    public RespJson deleteFeedback(@PathVariable("id") Long id){
        return feedbackService.deleteFeedback(id);
    }
}

